package ${packageName};
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import ${BASE_PACKAGE}.model.po.${tableInfo.className?cap_first}Entity;
import ${BASE_PACKAGE}.model.dto.${tableInfo.className?cap_first}DTO;
import ${BASE_PACKAGE}.model.param.${tableInfo.className?cap_first}Param;
import ${BASE_PACKAGE}.dao.mapper.${tableInfo.className?cap_first}Mapper;
import ${BASE_PACKAGE}.service.${tableInfo.className?cap_first}Service;
import java.util.List;
import com.umsin.base.model.dto.PageDataDTO;
import org.springframework.beans.BeanUtils;
import java.util.stream.Collectors;
import com.umsin.cloud.service.SnowflakeService;


/**
 * ${tableInfo.className?cap_first}服务实现类
 *
 * @author ${author}
 * @date ${.now?string("yyyy-MM-dd")}
 */
@Service
public class ${tableInfo.className?cap_first}ServiceImpl extends ServiceImpl<${tableInfo.className?cap_first}Mapper, ${tableInfo.className?cap_first}Entity> implements ${tableInfo.className?cap_first}Service {
    @Autowired
    private SnowflakeService snowflakeService;

    @Override
    public ${tableInfo.className?cap_first}Entity add(${tableInfo.className?cap_first}DTO dto) {
        ${tableInfo.className?cap_first}Entity entity = new ${tableInfo.className?cap_first}Entity();
        BeanUtils.copyProperties(dto, entity);
        entity.setId(snowflakeService.getLongId());
        baseMapper.insert(entity);
        return entity;
    }

    @Override
    public void modify(${tableInfo.className?cap_first}DTO dto) {
        ${tableInfo.className?cap_first}Entity entity = new ${tableInfo.className?cap_first}Entity();
        BeanUtils.copyProperties(dto, entity);
        baseMapper.updateById(entity);
    }

    @Override
    public boolean remove(Long id) {
        return baseMapper.deleteById(id) > 0;
    }

    @Override
    public PageDataDTO<${tableInfo.className?cap_first}DTO> page(${tableInfo.className?cap_first}Param param) {
        // 调用dao的page方法
        return baseMapper.page(param);
    }

    @Override
    public List<${tableInfo.className?cap_first}DTO> list(${tableInfo.className?cap_first}Param param) {
        // 实现逻辑
        return baseMapper.list(param);
    }
}